﻿using UnityEngine;

public static partial class Tools
{
    /// <summary>
    /// 通过路径创建GameObject
    /// </summary>
    public static GameObject CreateGameObjectByPath(string path)
    {
        GameObject go = null;
        var goNames = path.Split('/');
        for (int i = 0; i < goNames.Length; i++)
        {
            var childGo = new GameObject(goNames[i]);
            if (go != null)
            {
                childGo.transform.parent = go.transform;
            }
            go = childGo;
        }
        return go;
    }
}